﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClumsyWordsWP8
{
    public class TermProperties
    {
        public TermProperties() : this(string.Empty, PartOfSpeech.unidentified, string.Empty) { }

        public TermProperties(string definition, PartOfSpeech partOfSpeech, string example) 
        {
            this._definition = definition;
            this._partOfSpeech = partOfSpeech;
            this._example = example;
        }

        /// <summary>
        /// The meaning of the term.
        /// </summary>
        private string _definition;
        public string Definition
        {
            get { return this._definition; }

            set
            {
                this._definition = value;
                NotifyPropertyChanged("Definition");
            }
        }

        /// <summary>
        /// Shows what part of speech the term is.
        /// </summary>
        private PartOfSpeech _partOfSpeech;
        public PartOfSpeech PartOfSpeech
        {
            get { return this._partOfSpeech; }

            set
            {
                this._partOfSpeech = value;
                NotifyPropertyChanged("PartOfSpeech");
            }
        }

        /// <summary>
        /// Provides an example use of the term if available.
        /// </summary>
        private string _example;
        public string Example
        {
            get { return this._example; }

            set
            {
                this._example = value;
                NotifyPropertyChanged("Example");
            }
        }

        #region NotifyPropertyChanged Implementation
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }
}
